﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Espam.Idiomas.Decimo.Tesis.Datos;
using System.Data;
using System.Data.SqlClient;

namespace Espam.Idiomas.Decimo.Tesis.Negocio
{
    public class Admin
    {
        public int nUsuarios { get; set; }
        public int nUbicaiciones { get; set; }
        public int nMatriculados { get; set; }
        public int nModulos { get; set; }
        public int nDocentes { get; set; }
        public int nNiveles { get; set; }

        public List<Admin> getDatosPanelAdmin()
        {
            List<Admin> lista = new List<Admin>();
            BaseDatos oBase = new BaseDatos();
            SqlDataReader reader;
            try
            {
                SqlCommand comando = new SqlCommand("sp_getDatosPanelAdmin", oBase.conexion);
                comando.CommandType = CommandType.StoredProcedure;
                oBase.Conectar();
                reader = comando.ExecuteReader();
                while (reader.Read())
                {
                    Admin oAd = new Admin();
                    oAd.nUsuarios = reader.GetInt32(0);
                    oAd.nDocentes = reader.GetInt32(1);
                    oAd.nUbicaiciones = reader.GetInt32(2);
                    oAd.nNiveles = reader.GetInt32(3);
                    oAd.nModulos = reader.GetInt32(4);
                    oAd.nMatriculados = reader.GetInt32(5);
                    lista.Add(oAd);
                }
            }
            catch (Exception)
            {

                lista = null;
            }
            finally
            {
                oBase.CerrarConexion();
            }

            return lista;
        }
    }
}
